﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Semantics;
namespace AutoResponse.Dialogue
{
    class Preparser
    {
        public static bool PreParse(ProcessResult result)
        {
            if (IsAllDigit(result.Words))
            {
                Node digits = new Node(result.Words);
                result.Graph = new Graph();
                result.Graph.EnrollNode(digits);
                result.Graph.RootNode = result.Graph.ResolveNode(result.Words);
                return true;
            }
            else
                return false;
        }

        static bool IsAllDigit(string text)
        {
            for (int i = 0; i < text.Length; i++)
            {
                if (!Char.IsDigit(text[i]))
                {
                    return false;
                }
            }
            return true;
        }
    }
}
